<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>DUXCMS 2.X 安装向导</title>
<link href="__PUBLIC__/css/base.css" rel="stylesheet" type="text/css">
<link href="__PUBLIC__/css/install.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/ui/jquery.js"></script>
</head>

<body>
<div class="install_main">
  <div class="install_menu">
    <ul>
      <li>阅读协议</li>
      <li>环境测试</li>
      <li class="selected">数据库信息</li>
      <li>安装完毕</li>
    </ul>
  </div>
  <div class="install_content">
    <div class="title">欢迎使用DUXCMS安装向导</div>
    <form action="<?php echo url('index/install'); ?>" method="post" id="form">
    <div class="central">
      <div class="m-form">
        
          <fieldset>
          <div class="formitm">
            <label class="lab" >数据库主机：</label>
            <div class="ipt">
              <input name="DB[DB_HOST]" type="text" class="u-ipt" id="DB_HOST" value="localhost" style="width:185px;" onblur="test_data()" />
              <input name="DB[DB_PORT]" type="text" class="u-ipt" id="DB_PORT" value="3306" style="width:100px;" onblur="test_data()" />
               </div>
          </div>
          <div class="formitm">
            <label class="lab" >用户名：</label>
            <div class="ipt">
              <input name="DB[DB_USER]" type="text" class="u-ipt" id="DB_USER" value="root" onblur="test_data()" />
               </div>
          </div>
          <div class="formitm">
            <label class="lab" >密码：</label>
            <div class="ipt">
              <input name="DB[DB_PWD]" type="text" class="u-ipt" id="DB_PWD" value="" onblur="test_data()" />
               </div>
          </div>
          <div class="formitm">
            <label class="lab" >数据库名：</label>
            <div class="ipt">
              <input name="DB[DB_NAME]" type="text" class="u-ipt" id="DB_NAME" value="" style="width:185px;" onblur="test_data()" />
              &nbsp;&nbsp;&nbsp;<input name="create" id="create" type="checkbox" value="1" checked="checked" onclick="test_data()" > 创建
               </div>
          </div>
          <div class="formitm">
            <label class="lab" >表前缀：</label>
            <div class="ipt">
              <input name="DB[DB_PREFIX]" type="text" class="u-ipt" id="DB_PREFIX" value="dux_" />
               </div>
          </div>
          <div class="formitm">
            <label class="lab" >COOKIE特征码：</label>
            <div class="ipt">
              <input name="APP[COOKIE_PREFIX]" type="text" class="u-ipt" value="<?php echo getcode(5); ?>_" />
               </div>
          </div>
          <div class="formitm">
            <label class="lab" >安全加密码：</label>
            <div class="ipt">
              <input name="APP[SAFE_KEY]" type="text" class="u-ipt" value="<?php echo getcode(20); ?>" />
               </div>
          </div>
          <div class="formitm">
            <label class="lab" >安装测试数据：</label>
            <div class="ipt">
              <input name="test" type="checkbox" value="1"> 安装
               </div>
          </div>
          </fieldset>
       
      </div>
    </div>
    <div class="bottuns">
    	<div class="msg" ><span style="color:#666">请先填写信息...</span></div>
    </div>
     </form>
  </div>
</div>
<script>
function test_data(){
	 val=$('#create').attr("checked");
     if(val){
		 create=1;
     }else{
     	create=0;
     } 
	 $.post(
	 '{$url(index/test_data)}',
	 {
		 DB_HOST:$('#DB_HOST').val(),
		 DB_PORT:$('#DB_PORT').val(),
		 DB_NAME:$('#DB_NAME').val(),
		 DB_USER:$('#DB_USER').val(),
		 DB_PWD:$('#DB_PWD').val(),
		 create:create
	 },
	 function(html){
		 if(html==1){
			 $('.msg').html('<button  type="submit" > </button>');
		 }else{
			 $('.msg').html('<span style="color:red">'+html+'</span>');
		 }
	 },'html');
}

</script>
</body>
</html>
